home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qtoolbutton.h.z / qtoolbutton.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  2.4 KB  |  102 lines

  1. /****************************************************************************
  2. ** $Id: qtoolbutton.h,v 2.6 1998/07/08 14:37:45 agulbra Exp $
  3. **
  4. ** Definition of a buttom customized for tool bar use
  5. **
  6. ** Created : 979899
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QTOOLBUTTON_H
  25. #define QTOOLBUTTON_H
  26.  
  27. #ifndef QT_H
  28. #include "qbutton.h"
  29. #include "qstring.h"
  30. #include "qpixmap.h"
  31. #include "qiconset.h"
  32. #endif // QT_H
  33.  
  34.  
  35. class QToolButtonPrivate;
  36.  
  37. class QToolBar;
  38.  
  39.  
  40. class QToolButton: public QButton
  41. {
  42.     Q_OBJECT
  43. public:
  44.     QToolButton( QWidget * parent = 0, const char * name = 0 );
  45.     QToolButton( const QPixmap & pm, const char * textLabel,
  46.          const char * grouptext,
  47.          QObject * receiver, const char * slot,
  48.          QToolBar * parent, const char * name = 0 );
  49.     QToolButton( QIconSet s, const char * textLabel,
  50.          const char * grouptext,
  51.          QObject * receiver, const char * slot,
  52.          QToolBar * parent, const char * name = 0 );
  53.     ~QToolButton();
  54.  
  55.     QSize sizeHint() const;
  56.  
  57.     void setIconSet( const QIconSet & );
  58.     QIconSet iconSet() const;
  59.  
  60.     bool usesBigPixmap() const { return ubp; }
  61.     bool usesTextLabel() const { return utl; }
  62.     const char * textLabel() const { return tl; }
  63.  
  64. public slots:
  65.     virtual void setUsesBigPixmap( bool enable );
  66.     virtual void setUsesTextLabel( bool enable );
  67.     virtual void setTextLabel( const char *, bool = TRUE );
  68.  
  69.     void setToggleButton( bool enable );
  70.  
  71.     void setOn( bool enable );
  72.     void toggle();
  73.  
  74. protected:
  75.     void drawButton( QPainter * );
  76.     void drawButtonLabel( QPainter * );
  77.  
  78.     void enterEvent( QEvent * );
  79.     void leaveEvent( QEvent * );
  80.  
  81.     bool uses3D() const;
  82.  
  83. private:
  84.     void init();
  85.  
  86.     QPixmap bp;
  87.     int bpID;
  88.     QPixmap sp;
  89.     int spID;
  90.  
  91.     QString tl;
  92.  
  93.     QToolButtonPrivate * d;
  94.     QIconSet * s;
  95.  
  96.     uint utl: 1;
  97.     uint ubp: 1;
  98. };
  99.  
  100.  
  101. #endif
  102.